package org.budo.support.java.net.util;

import java.net.InetSocketAddress;

import org.springframework.beans.factory.FactoryBean;

/**
 * @author limingwei
 */
public class InetSocketAddressFactoryBean implements FactoryBean<InetSocketAddress> {
    private String hostname;

    private int port;

    @Override
    public InetSocketAddress getObject() throws Exception {
        return new InetSocketAddress(this.getHostname(), this.getPort());
    }

    @Override
    public Class<?> getObjectType() {
        return InetSocketAddress.class;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }

    public String getHostname() {
        return this.hostname;
    }

    public void setHostname(String hostname) {
        this.hostname = hostname;
    }

    public int getPort() {
        return this.port;
    }

    public void setPort(int port) {
        this.port = port;
    }
}